﻿using System;
using System.Collections.Generic;
using System.Text;
using Jw.Core;

namespace Jw.Models
{
    [Module("Pacm")]
    public class q_LdphbzService : ServiceBase<q_Ldphbz>
    {

        protected override bool OnBeforEdit(EditEventArgs arg)
        {
            //根据部门编号更新部门名称
            if (arg.form["Ldphbz_Bmbh"] == null) return base.OnBeforEdit(arg);
            string sDwid = arg.form["Ldphbz_Bmbh"].ToString();
            string sBillNo = arg.form["Ldphbz_BillNo"].ToString();
            sys_organize organize = new sys_organizeService().GetModel(new ParamQuery().AndWhere("OrganizeCode", sDwid));
            if (organize != null)
            {
                q_LdphbzService objService = new q_LdphbzService();
                arg.form["Ldphbz_Bmmc"] = organize.OrganizeName;
            }
            return base.OnBeforEdit(arg);
        }
        /// <summary>
        /// 删除前要执行的操作
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        protected override bool OnBeforeDelete(DeleteEventArgs arg)
        {
            arg.db.Delete("q_LdphbzDetail").Where("LdphbzDetail_BillNo", arg.data.GetValue("Ldphbz_BillNo")).Execute();
            return base.OnBeforeDelete(arg);
        }
    }

    public class q_Ldphbz : ModelBase
    {

        /// <summary>
        /// BillNo
        /// <summary>
        [PrimaryKey]
        public string Ldphbz_BillNo { get; set; }

        /// <summary>
        /// 送检日期
        /// </summary>
        public DateTime Ldphbz_BillDate { get; set; }
        /// <summary>
        /// 送检部门编号
        /// <summary>
        public string Ldphbz_Bmbh { get; set; }
        /// <summary>
        /// 送检部门名称
        /// <summary>
        public string Ldphbz_Bmmc { get; set; }
        /// <summary>
        /// 检验方法
        /// <summary>
        public string Ldphbz_Jyff { get; set; }
        /// <summary>
        /// 判断依据
        /// <summary>
        public string Ldphbz_Pdyj { get; set; }
        /// <summary>
        /// 报告编号
        /// <summary>
        public string Ldphbz_Bgbh { get; set; }
        /// <summary>
        /// 说明
        /// <summary>
        public string Ldphbz_Remark { get; set; }
        /// <summary>
        /// 创建人
        /// <summary>
        public string CreatePerson { get; set; }
        /// <summary>
        /// 创建日期
        /// <summary>
        public DateTime? CreateDate { get; set; }
        /// <summary>
        /// 修改人
        /// <summary>
        public string UpdatePerson { get; set; }
        /// <summary>
        /// 修改日期
        /// <summary>
        public DateTime? UpdateDate { get; set; }
        /// <summary>
        /// 审核人
        /// <summary>
        public string ApprovePerson { get; set; }
        /// <summary>
        /// 审核日期
        /// <summary>
        public DateTime? ApproveDate { get; set; }
        /// <summary>
        /// 审核状态
        /// <summary>
        public string ApproveState { get; set; }
        /// <summary>
        /// 审核说明
        /// <summary>
        public string ApproveRemark { get; set; }
    }
}
